<?php echo View::factory('admin/news/news_left')->set('catalog_tree', $catalog_tree)->render(); ?>
<script charset="utf-8" src="/media/js/editor/kindeditor.js"></script>
<script type="text/javascript" src="/media/js/catalog/catalog_admin.js"></script>
<link href="/media/js/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/media/js/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/media/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="/media/js/my_validation.js"></script>
<script>  
    /****************编辑器 加载开始******************/
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('#chr_context');
    });
    /****************编辑器 加载结束******************/
    $(document).ready(function() {
        //传图片
        $('#submittype').click(function() {
            $('#custom_file_upload').uploadifyUpload();
        });        
        
        //上传确定按钮UI样式
        $('#upload').button({
            icons:{
                primary:"ui-icon ui-icon-disk"
            },
            text:true
        });
        /****************上传配置开始*******************/
        $('#custom_file_upload').uploadify({
            'uploader'       : '/media/js/uploadify/uploadify.swf',
            'script'         : '/admin/uploadify/images/cheers_main_newsimage--<?php echo $data['chr_newsid'] ?>--2',
            'cancelImg'      : '/media/js/uploadify/cancel.png',
            'folder'         : '/uploads/newstype',
            'multi'          : false,
            'auto'           : false,
            'fileExt'        : '*.jpg;*.gif;*.png',
            'fileDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
            'queueID'        : 'custom-queue',
            'queueSizeLimit' : 300,
            'simUploadLimit' : 2,
            'removeCompleted': false,
            'displayData'   : 'shown',
            'onSelectOnce'   : function(event,data) {
                $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
            },
            'onAllComplete'  : function(event,data) {
                $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
            }
        });	
        /****************上传配置结束*******************/
    });
</script>
<div id="do_right" class="catalog_right">
    <div class="box" style="overflow:hidden;">
        <h3 id="h3_left">添加新闻</h3>
        <div id="right_button"><a href="/admin/news/list"><button id="back">返回新闻分类</button></a></div>
        <div class="clear"></div>
        <form method="post" action="/admin/news/edit/<?php echo $data['chr_newsid']; ?>" class="need_validation" id="commentForm" >
            <div id="tabs">
                <ul>
                    <li><a href="#tabs-1">基本资料</a></li>
                    <li><a href="#tabs-2">新闻内容</a></li>
                    <li><a href="#tabs-3">图片上传</a></li>

                </ul>
                <!--START tabs-1 -->
                <div id="tabs-1">
                    <ul>
                        <li>
                            <label for="chr_title" class="lable_title">新闻名称<span class="req">*</span></label>
                            <input name="chr_title" id="chr_title" class="text medium required" type="text" value="<?php echo $data['chr_title'] ?>"/>
                        </li>
                        <li>
                            <label for="chr_typeid" class="lable_title">新闻分类</label>
                            <select class="drop" name="chr_typeid" id="chr_typeid">
                                <?php
                                echo $catalog_opt == '' ? '<option value="0">--ROOT--</option>' : $catalog_opt;
                                ?>
                            </select>

                        </li>
                        <li>
                            <label for="chr_author" class="lable_title">作者</label>
                            <input name="chr_author" id="chr_author" class="text"  value="<?php echo $data['chr_author'] ?>"/>
                        </li>
                        <li>
                            <label for="chr_source" class="lable_title">来源</label>
                            <input name="chr_source" id="chr_source" class="text medium url" type="text" value="<?php echo $data['chr_source'] ?>"/><span class="notice_span">(例如:http://www.xuwentec.com)</span>
                        </li>
                        <li>
                            <label for="chr_createdate" class="lable_title">添加时间</label>
                            <input name="chr_createdate" id="chr_createdate" class="text  Wdate" type="text" value="<?php echo $data['chr_createdate'] ?>" onClick="WdatePicker()"/>
                        </li>
                        <li>
                            <label for="chr_ticks" class="lable_title">点击数</label>
                            <input name="chr_ticks" id="chr_ticks" class="text number" type="text" value="<?php echo $data['chr_ticks'] ?>"/>
                        </li>
                        <li>
                            <label for="chr_tag" class="lable_title">新闻标签</label>
                            <input name="chr_tag" id="chr_tag" class="text" type="text" value="<?php echo $data['chr_tag'] ?>"/>
                        </li>
                        <li>
                            <label for="chr_introduction" class="lable_title">简介</label>
                            <textarea name="chr_introduction" id="chr_introduction" class="textarea" style="width:700px;height:100px;"><?php echo $data['chr_introduction'] ?></textarea>
                        </li>
                        <li>
                            <label for="chr_keywords" class="lable_title">新闻keywords</label>
                            <input name="chr_keywords" id="chr_keywords" class="text medium" type="text" value="<?php echo $data['chr_keywords'] ?>"/>
                        </li>
                        <li>
                            <label for="chr_desc" class="lable_title">新闻Description</label>
                            <textarea name="chr_desc" id="chr_desc" class="textarea" style="width:700px;height:100px;"><?php echo $data['chr_desc'] ?></textarea>
                        </li>

                    </ul>
                    <div style="clear:both;"></div>
                </div>
                <!--END tabs-1 -->

                <!--START tabs-2 -->
                <div id="tabs-2">
                    <div>
                        <textarea name="chr_context" id="chr_context" class="textarea" style="width:950px;height:300px;"><?php echo $data['chr_context'] ?></textarea>
                    </div>
                </div>
                <!--END tabs-2 -->
                <!--START tabs-3 -->
                <div id="tabs-3">
                    <input id="custom_file_upload" type="file" name="chr_typefile" /> 
                    <div id="custom-queue"></div>
<!--                    <div style="margin-top: 10px;"><a href="javascript:$('#custom_file_upload').uploadifyUpload();"><button id="upload" type="button">确定上传</button></a></div>-->
                </div>
                <!--END tabs-3 -->
            </div>
            <ul>
                <li style="text-align: center;">
                    <input value="修改" class="button" type="submit" id="submittype"/>
                </li>
            </ul>
        </form>
    </div>
</div>
